package com.helloworld.demo.atomic;

import java.util.concurrent.atomic.AtomicIntegerArray;

public class ThreadAtomicArray {
    private static int[] arr = new int[]{1,2,3,4,5};
    private static AtomicIntegerArray atomicIntegerArray = new AtomicIntegerArray(arr);

    public static void main(String[] args) {
        atomicIntegerArray.set(0,100);
        System.out.println(atomicIntegerArray.get(0));
        int andAdd = atomicIntegerArray.getAndAdd(1, 5);
        System.out.println(andAdd);
        System.out.println(atomicIntegerArray);
    }
}
